package gui.commands.classDiagramCommands;

import data.DataVector;
import data.classDiagram.Entity;
import gui.commands.ICommand;

/**
 * User: Szymon Kudzia
 * Date: 10.05.13
 * Time: 14:48
 */
public class AddNewImplementedInterfaceCommand implements ICommand {
	protected String impInterface;
	protected Entity entity;

	public AddNewImplementedInterfaceCommand(String impInterface) {
		this.impInterface = impInterface;
	}

	@Override
	public void execute() {
		entity = DataVector.getInstance().getActiveEntity();

		entity.addInterfaceImplemented(impInterface);

		DataVector.getInstance().refresh();
	}

	@Override
	public void undo() {
		entity.getInterfacesImplemented().remove(impInterface);
	}

	@Override
	public void redo() {
		entity.addInterfaceImplemented(impInterface);
	}
}
